package day03;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//请求重定向的案列演示
public class A02_李四Servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("李四执行了");
        //public void sendRedirect(String location) throws IOException; 请求重定向方法
        //location 李四告诉张三 王五的位置
        resp.sendRedirect("/request/wwServlet");

        //重定向到其他服务器
//        resp.sendRedirect("https://www.baidu.com/");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         doGet(req, resp);
    }
}
